<?php
/**
 * 
 *
 * @category   Application_Extensions
 * @package    Paint
 * @copyright  Copyright 2006-2010 Idragonsolution Developments
 * @license    http://idragonsolution.com/
 * @version    $Id: Bootstrap.php 9747 2012-07-26 02:08:08Z Thien $
 * @author     Thien
 */
?>

<div class="headline">
  <h2>
    <?php echo $this->translate('Scribls');?>
  </h2>
  <div class="tabs">
    <?php
      // Render the menu
      echo $this->navigation()
        ->menu()
        ->setContainer($this->navigation)
        ->render();
    ?>
  </div>
</div>

<div class='layout_right'>
  <?php echo $this->form->render($this) ?>
  
</div>


<div class='layout_middle'>

  <?php if( $this->paginator->getTotalItemCount() > 0 ): ?>

    <ul class="thumbs">
      <?php foreach( $this->paginator as $album ): ?>
        <li>
          <a class="thumbs_photo" href="<?php echo $album->getHref(); ?>">
            <!-- <span style="background-image: url(<?php echo $album->getPhotoUrl('thumb.normal'); ?>);"></span> -->
            <?php echo $this->itemPhoto($album, 'thumb.normal') ?>
          </a>
          <p class="thumbs_info">
            <span class="thumbs_title">
              <?php echo $this->htmlLink($album, $this->string()->chunk($this->string()->truncate($album->getTitle(), 45), 10)) ?>
            </span>
            <?php echo $this->translate('By');?>
            <?php echo $this->htmlLink($album->getOwner()->getHref(), $album->getOwner()->getTitle(), array('class' => 'thumbs_author')) ?>
            <br />
            
          </p>
        </li>
      <?php endforeach;?>
    </ul>

    <?php if( $this->paginator->count() > 1 ): ?>
      <br />
      <?php echo $this->paginationControl(
        $this->paginator, null, null, array(
          'pageAsQuery' => false,
          'query' => $this->searchParams
          )); ?>
    <?php endif; ?>
  
    <?php elseif( $this->searchParams['category_id'] ): ?>
    <div class="tip">
      <span>
        <?php echo $this->translate('Nobody has created a scribl with that criteria.');?>
        <?php if( $this->canCreate ): ?>
          <?php echo $this->translate('Be the first to %1$screate%2$s one!', '<a href="'.$this->url(array('action' => 'upload')).'">', '</a>'); ?>
        <?php endif; ?>
      </span>
    </div>    
    
    <?php else: ?>
    <div class="tip">
      <span>
        <?php echo $this->translate('Nobody has created a scribl yet.');?>
        <?php if( $this->canCreate ): ?>
          <?php echo $this->translate('Be the first to %1$screate%2$s one!', '<a href="'.$this->url(array('action' => 'upload')).'">', '</a>'); ?>
        <?php endif; ?>
      </span>
    </div>
  <?php endif; ?>
</div>